package com.rizzo.shell.intern;

import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.shell.core.CommandMarker;
import org.springframework.shell.core.annotation.CliCommand;
import org.springframework.shell.plugin.support.DefaultBannerProvider;
import org.springframework.shell.support.util.OsUtils;
import org.springframework.stereotype.Component;

@Component
@Order(Ordered.HIGHEST_PRECEDENCE)
public class RizzoShellBannerProvider extends DefaultBannerProvider implements CommandMarker {

	@CliCommand(value = {"version"}, help = "Displays current CLI version")
	public String getBanner() {
		StringBuilder stringBuilder = new StringBuilder();
		stringBuilder.append("   ____  _                ____  _          _ _   ").append(OsUtils.LINE_SEPARATOR);
		stringBuilder.append("  |  _ \\(_)___________   / ___|| |__   ___| | |  ").append(OsUtils.LINE_SEPARATOR);
		stringBuilder.append("  | |_) | |_  /_  / _ \\  \\___ \\| '_ \\ / _ \\ | |  ").append(OsUtils.LINE_SEPARATOR);
		stringBuilder.append("  |  _ <| |/ / / / (_) |  ___) | | | |  __/ | |  ").append(OsUtils.LINE_SEPARATOR);
		stringBuilder.append("  |_| \\_\\_/___/___\\___/  |____/|_| |_|\\___|_|_|  ").append(OsUtils.LINE_SEPARATOR);
		stringBuilder.append("    ").append(OsUtils.LINE_SEPARATOR);
		stringBuilder.append("  version ").append(getVersion()).append(OsUtils.LINE_SEPARATOR);
		return stringBuilder.toString();
	}

	public String getVersion() {
		return "0.1.0-SNAPSHOT";
	}

	public String getWelcomeMessage() {
		return "Welcome to the Rizzo Shell";
	}

	@Override
	public String name() {
		return "Rizzo Shell";
	}
}
